package com.chenfan.process.enums;

import lombok.Getter;

/**
 * @author K
 * @date 2021-05-11
 */
public enum InstanceEnums {
    /**
     * 审批中
     */
    NORMAL(0, "审批中", "-"),
    /**
     * 审批通过
     */
    PASS(1, "审批通过", "√"),
    /**
     * 审批拒绝
     */
    REFUSE(2, "审批拒绝", "×"),

    /**
     * 驳回
     */
    REJECTED(3, "驳回", "↑"),
    /**
     * 审批撤回
     * 
     */
    REVOKE(5, "审批撤回", "←"),;

    @Getter
    private Integer code;
    @Getter
    private String message;
    @Getter
    private String symbol;

    InstanceEnums(Integer code, String message, String symbol) {
        this.code = code;
        this.message = message;
        this.symbol = symbol;
    }

    public static String getMessage(Integer code) {
        for (InstanceEnums v : values()) {
            if (v.getCode().equals(code)) {
                return v.getMessage();
            }
        }
        return "";
    }

    public static String getSymbol(Integer code) {
        for (InstanceEnums v : values()) {
            if (v.getCode().equals(code)) {
                return v.getSymbol();
            }
        }
        return "";
    }

    public static boolean normal(Integer code) {
        return InstanceEnums.NORMAL.getCode().equals(code);
    }
}
